 /*
  * Mango CMS
  * Copyright 2008, Mango Web, and individual contributors as indicated
  * by the @authors tag. See the copyright.txt in the distribution for a
  * full listing of individual contributors.
  *
  * This is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as
  * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
package org.mangocms.admin.model.todo;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;
import org.mangocms.model.user.User;

/**
 * A entry in the Mango admin todo list component
 * 
 * @author <a href="tanordheim@gmail.com">Trond Arve Nordheim</a>
 * @version $Revision: 1.1 $
 */
@Entity
@Table(name = "mango_admin_todo_entry")
public class TodoEntry implements Serializable {

	private static final long serialVersionUID = 1L;

	@Column(name = "id")
	@Id @GeneratedValue
	private Integer id;
	
	@Column(name = "title")
	@Length(max = 255)
	@NotNull
	private String title;
	
	@OneToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "author_id", referencedColumnName = "id")
	@NotNull
	private User author;

	@OneToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "user_id", referencedColumnName = "id")
	@NotNull
	private User user;
	
	@Lob
	@NotNull
	private String description;
	
	@Column(name = "created_time")
	@NotNull
	private Date createdTime;
	
	@Column(name = "due_time")
	@NotNull
	private Date dueTime;
	
	@Column(name = "finished_time")
	private Date finishedTime;
	
	@Column(name = "progression")
	@NotNull
	private Integer progression;
	
	/**
	 * Create a new TodoEntry.
	 */
	public TodoEntry() {
	}

	/**
	 * Get the id.
	 * 
	 * @return the id.
	 */
	public Integer getId() {
		return id;
	}

	/**
	 * Set the id.
	 * 
	 * @param id The id to set.
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	 * Get the title.
	 * 
	 * @return the title.
	 */
	public String getTitle() {
		return title;
	}

	/**
	 * Set the title.
	 * 
	 * @param title The title to set.
	 */
	public void setTitle(String title) {
		this.title = title;
	}

	/**
	 * Get the author.
	 * 
	 * @return the author.
	 */
	public User getAuthor() {
		return author;
	}

	/**
	 * Set the author.
	 * 
	 * @param author The author to set.
	 */
	public void setAuthor(User author) {
		this.author = author;
	}

	/**
	 * Get the user.
	 * 
	 * @return the user.
	 */
	public User getUser() {
		return user;
	}

	/**
	 * Set the user.
	 * 
	 * @param user The user to set.
	 */
	public void setUser(User user) {
		this.user = user;
	}

	/**
	 * Get the description.
	 * 
	 * @return the description.
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * Set the description.
	 * 
	 * @param description The description to set.
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * Get the createdTime.
	 * 
	 * @return the createdTime.
	 */
	public Date getCreatedTime() {
		return createdTime;
	}

	/**
	 * Set the createdTime.
	 * 
	 * @param createdTime The createdTime to set.
	 */
	public void setCreatedTime(Date createdTime) {
		this.createdTime = createdTime;
	}

	/**
	 * Get the dueTime.
	 * 
	 * @return the dueTime.
	 */
	public Date getDueTime() {
		return dueTime;
	}

	/**
	 * Set the dueTime.
	 * 
	 * @param dueTime The dueTime to set.
	 */
	public void setDueTime(Date dueTime) {
		this.dueTime = dueTime;
	}

	/**
	 * Get the finishedTime.
	 * 
	 * @return the finishedTime.
	 */
	public Date getFinishedTime() {
		return finishedTime;
	}

	/**
	 * Set the finishedTime.
	 * 
	 * @param finishedTime The finishedTime to set.
	 */
	public void setFinishedTime(Date finishedTime) {
		this.finishedTime = finishedTime;
	}

	/**
	 * Get the progression.
	 * 
	 * @return the progression.
	 */
	public Integer getProgression() {
		return progression;
	}

	/**
	 * Set the progression.
	 * 
	 * @param progression The progression to set.
	 */
	public void setProgression(Integer progression) {
		this.progression = progression;
	}

}
